﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kokomo.Environment.Services
{
	/// <summary>
	/// Thrown when a caller requests a service that is not registered.
	/// </summary>
	/// <remarks>
	/// <see cref="EnvironmentServices.DemandService"/> throws this exception.
	/// </remarks>
	public class MissingServiceException : Exception
	{
		/// <summary>
		/// Initializes a new <see cref="MissingServiceException"/>.
		/// </summary>
		/// <param name="serviceType">The type of service requested.</param>
		public MissingServiceException(Type serviceType)
			: base(string.Format(Messages.MissingServiceExceptionText, serviceType.FullName))
		{
			if (serviceType == null) throw new ArgumentNullException("serviceType");

			this.ServiceType = serviceType;
		}

		/// <summary>
		/// Gets the type of the service requested.
		/// </summary>
		public Type ServiceType { get; private set; }
	}
}
